import type { AdColumn } from '@/components/AdVxeTable';

import { getIoTGatewayProtocolTypeEnumSchema } from '@/enums/iot/ioTGatewayProtocolTypeEnum';
import { getIoTPlatformTypeEnumSchema } from '@/enums/iot/ioTPlatformTypeEnum';
import { useI18n } from '@/hooks/web/useI18n';

const ioTGatewayProtocolTypeEnumSchema = getIoTGatewayProtocolTypeEnumSchema();
const ioTPlatformTypeEnumSchema = getIoTPlatformTypeEnumSchema();
const { t } = useI18n();

export const columns: AdColumn[] = [
  {
    title: t('entity.idTitle'),
    field: 'Id',
    width: 200,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('iot.route.gateway.client.gatewayIdText'),
    field: 'GatewayId',
    width: 180,
    visible: false,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.gateway.client.gatewayNameText'),
    field: 'GatewayName',
    width: 200,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'string',
  },
  {
    title: t('iot.route.gateway.client.protocolTypeText'),
    field: 'ProtocolType',
    width: 90,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'enum',
    enumData: ioTGatewayProtocolTypeEnumSchema,
  },
  {
    title: t('iot.route.gateway.client.platformTypeText'),
    field: 'PlatformType',
    width: 150,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'enum',
    enumData: ioTPlatformTypeEnumSchema,
  },
  {
    title: t('iot.route.gateway.client.connectedTimeText'),
    field: 'ConnectedTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('iot.route.gateway.client.lastPacketReceivedTimeText'),
    field: 'LastPacketReceivedTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('iot.route.gateway.client.lastPacketSentTimeText'),
    field: 'LastPacketSentTime',
    width: 180,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'datetime',
  },
  {
    title: t('iot.route.gateway.client.receivedPacketsText'),
    field: 'ReceivedPackets',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: false,
    dataType: 'integer',
  },

  {
    title: t('iot.route.gateway.client.sentPacketsText'),
    field: 'SentPackets',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.gateway.client.receivedBytesText'),
    field: 'ReceivedBytes',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: false,
    dataType: 'integer',
  },
  {
    title: t('iot.route.gateway.client.sentBytesText'),
    field: 'SentBytes',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.gateway.client.receivedMessagesText'),
    field: 'ReceivedMessages',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.gateway.client.sentMessagesText'),
    field: 'SentMessages',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
  {
    title: t('iot.route.gateway.client.pendingMessagesText'),
    field: 'PendingMessages',
    width: 100,
    formVisible: true,
    formEditable: false,
    filterable: true,
    dataType: 'integer',
  },
];
